# coding:utf-8

import pandas as pd
from sklearn.feature_selection import VarianceThreshold


def var_thr():
    """
    特征选择：低方差特征过滤
    :return:
    """
    data = pd.read_csv('./data/factor_returns.csv')
    print(data)

    transfer = VarianceThreshold(threshold=10)
    trans_data = transfer.fit_transform(data.iloc[:, 1:10])
    print('之前数据的形状：\n', data.iloc[:, 1:10].shape)
    print('之后数据的形状：\n', trans_data.shape)
    print(trans_data)


if __name__ == '__main__':
    var_thr()